package org.etcsoft.examples.genealogy.figures;

import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Rectangle;
import org.etcsoft.examples.genealogy.borders.NoteBorder;

/**
 * @author korman21@gmail.com
 *
 */
public class NoteFigure extends Label {
    public NoteFigure(String note) {
        super(note);
        this.setBorder(new NoteBorder());
    }

    @Override
    protected void paintFigure(Graphics graphics) {
        graphics.setBackgroundColor(ColorConstants.white);
        Rectangle b = this.getBounds();
        final int fold = NoteBorder.FOLD;
        graphics.fillRectangle(b.x + fold, b.y, b.width - fold, fold);
        graphics.fillRectangle(b.x, b.y + fold, b.width, b.height - fold);

        super.paintFigure(graphics);
    }
}
